import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("permission_rule", { schema: "cabinet" })
export class PermissionRule {
  @PrimaryGeneratedColumn({ type: "smallint", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "code", length: 50 })
  code: string;

  @Column("varchar", { name: "name", length: 10 })
  name: string;

  @Column("json", { name: "urls", nullable: true, comment: "对应的url" })
  urls: object | null;

  @Column("json", { name: "methods", nullable: true })
  methods: object | null;

  @Column("varchar", { name: "remark", length: 50 })
  remark: string;

  @Column("smallint", {
    name: "menu_id",
    comment: "菜单ID",
    unsigned: true,
    default: () => "'0'",
  })
  menuId: number;
}
